﻿@model EvincePayroll.Data.EmployeeData
@{
    Layout = "~/Views/Shared/_Layout_Login.cshtml";
    ViewBag.Title = "Register";
    var message = ViewBag.Message;
    var success = ViewBag.Success;
}
<link href="../../Content/Registration/view.css" rel="stylesheet" type="text/css" />
<script src="../../Scripts/Registration/calendar.js" type="text/javascript"></script>
<script src="../../Scripts/Registration/view.js" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        Calendar.setup({
            inputField: "element_5_3",
            baseField: "element_5",
            displayArea: "calendar_5",
            button: "cal_img_5",
            ifFormat: "%B %e, %Y",
            onSelect: selectDate
        });

        $('#txtContactNumber1').keyup(function () {
            var d = $(this).attr('numeric');
            var val = $(this).val();
            var orignalValue = val;
            val = val.replace(/[0-9]*/g, "");
            var msg = "Only Integer Values allowed.";
            if (val != '') {
                orignalValue = orignalValue.replace(/([^0-9].*)/g, "")
                $(this).val(orignalValue);
                //alert(msg);
            }
        });


        //requiredField /\d{1,5}(?:\.\d{1,5})?/    /[0-9]*/g
        $("#registrationPageId").submit(function () {
            var flag = false;
            $('.requiredField').each(function () {
                if ($(this).val() == '') {
                    if ($(this).prev().attr('class') != 'error') {
                        $(this).after('<span class="error"> *</span>');
                    }
                    $(this).css({
                        border: '1px solid red'
                    });
                    flag = true;
                } else {
                    if ($(this).prev().attr('class') == 'error') {
                        $(this).prev().remove();
                        $(this).removeAttr('style');
                    }
                }
            });
            if (flag == true) {
                return false;
            }

        });
        $('#element_1_1').val(''); $('#element_1_2').val(''); $('#element_1_3').val(''); $('#element_2').val(''); $('#element_3').val(''); $('#txtDateOfBirth').val('');
        $('#txtContact1').val(''); $('#txtTmpAddress').val(''); $('#txtPermanentAddress').val(''); $('#txtPincode').val(''); $('#txtState').val(''); $('#txtCity').val(''); $('#element_3').val('');
        $('#DOB').val(''); $('#txtContactNumber1').val(''); $('#txtContactNumber2').val(''); $('#txtTempAddress').val('');
        $('#btnCancel').click(function () {
            $('#element_1_1').val('');
            $('#element_1_2').val('');
            $('#element_1_3').val('');
            $('#element_2').val('');
            $('#element_3').val('');
            $('#txtDateOfBirth').val('');
            $('#txtContact1').val('');
            $('#txtTmpAddress').val('');
            $('#txtPermanentAddress').val('');
            $('#txtPincode').val('');
            $('#txtState').val('');
            $('#txtCity').val('');
            $('#element_3').val('');
            //$('#Dob').val('');
            $('#txtContactNumber1').val('');
            $('#txtContactNumber2').val('');
            $('#txtTempAddress').val('');
            return false;
        });

        $('#firstNameError').hide();
        $('#lastNameError').hide();
        $('#email').hide();
        $('#altemail').hide();
        $('#dobError').hide();
        $('#contactError').hide();
        $('#tempAddressError').hide();
        $('#paramAddressError').hide();
        $('#pinCodeError').hide();
        $('#stateError').hide();
        $('#cityError').hide();
        setDatePicker('txtDob');



    });
</script>
<hgroup class="title">
    
</hgroup>

@using (@Html.BeginForm("Register", "Account", FormMethod.Post, new { id = "registrationPageId", enctype = "multipart/form-data" }))
{
    
    
     @Html.AntiForgeryToken() @Html.ValidationSummary()

    <div class="grid_10" style="width: 800px; margin: 40px 10px 0px -1px;">
        <div class="box round first">
            <h2>
                Register</h2>
            <div class="block">
                <div id="chart1">
                    <div class="block">
                        @if (message != null && success != "Success")
                        {
                            <div class="message error">
                                <h5>
                                    Error</h5>
                                <p>
                                    @message
                                </p>
                            </div>
                    
                        }
                        @if (success == "Success")
                        {
                            <div class="message success">
                                <h5>
                                    Success</h5>
                                <p>
                                    @message<br />
                                    Now Please Contact Administrator.
                                </p>
                            </div>
                    
                        }
                        <ul style="border: 1px solid gray;">
                                        <li id="li_1">
                                            <label class="description" for="element_1">
                                                Name
                                            </label>
                                            <br />
                                            <span>
                                                @Html.TextBoxFor(m => m.FirstName, new { id = "element_1_1", @class = "element text requiredField", maxlength = "255", size = "8", value = "" })
                                                <span class="error" id="firstNameError">*</span>
                                                <label>
                                                    First</label>
                                                 </span><span>
                                                    @Html.TextBoxFor(m => m.MiddleName, new { id = "element_1_2", name = "element_1_2", @class = "element text", maxlength = "255", size = "8", value = "" })
                                                    <label>
                                                        Middel</label>
                                                </span><span>
                                                    @Html.TextBoxFor(m => m.LastName, new { id = "element_1_3", name = "element_1_2", @class = "element text requiredField", maxlength = "255", size = "8", value = "" })
                                                    <span class="error" id="lastNameError">*</span>
                                                    <label>
                                                        Last</label>
                                                     </span></li>
                                        <li id="li_2">
                                            <label class="description" for="element_2">
                                                Email
                                            </label>
                                            <br />
                                            <div>
                                                @Html.TextBoxFor(m => m.Email, new { id = "element_2", name = "element_2", @class = "element text medium requiredField", type = "text", maxlength = "255", value = "" })
                                                <span class="error" id="email">*</span>
                                            </div>
                                            <br />
                                            <br />
                                        </li>
                                        <li id="li_3">
                                            <label class="description" for="element_3">
                                                AlternateEmail
                                            </label>
                                            <br />
                                            <div>
                                                @Html.TextBoxFor(m => m.AlternateEmail, new { id = "element_3", name = "element_3", @class = "element text medium requiredField", type = "text", maxlength = "255", value = "" })
                                                <span class="error" id="altemail">*</span>
                                            </div>
                                            <br />
                                            <br />
                                        </li>
                                        <li id="li_5">
                                            <label class="description" for="element_5">
                                                Date
                                            </label>
                                            <br />
                                            <span>
                                                <input id="element_5_1" name="month" class="element text" size="2" maxlength="2"
                                                    value="" type="text" />
                                                /
                                                <label for="element_5_1">
                                                    MM</label>
                                            </span><span>
                                                <input id="element_5_2" name="date" class="element text" size="2" maxlength="2" value=""
                                                    type="text" />
                                                /
                                                <label for="element_5_2">
                                                    DD</label>
                                            </span><span>
                                                <input id="element_5_3" name="year" class="element text" size="4" maxlength="4" value=""
                                                    type="text" />
                                                <label for="element_5_3">
                                                    YYYY</label>
                                            </span><span id="calendar_5">
                                                <img id="cal_img_5" class="datepicker" src="../../Images/calendar.gif"
                                                    alt="Pick a date." />
                                            </span>
                                            <span class="error" id="dobError">*</span>
                                            </li>
                                            <li id="li_14">
                                            <label class="description" for="element_6">
                                                Gender
                                            </label>
                                            <br />
                                            <div>
                                            @Html.DropDownListFor(m => m.Gender, new SelectList(ViewBag.Gender as System.Collections.IEnumerable), new { id = "gender", @class = "element text medium", @style = "float:left;" })
                                            </div>
                                            <br />
                                            <br />
                                        </li>
                                        <li id="li_6">
                                            <label class="description" for="element_6">
                                                Upload Profile Image
                                            </label>
                                            <br />
                                            <div>
                                                <input id="profileImage" name="profileImage" class="element file" type="file" />
                                            </div>
                                            <br />
                                            <br />
                                        </li>
                                     <li id="li_4">
                            <label class="description" for="element_3">
                                Contact 1
                            </label>
                            <br />
                            <div>
                                @Html.TextBoxFor(m => m.ContactNumber1, new { id = "txtContactNumber1", name = "element_3", @class = "element text medium requiredField", type = "text", maxlength = "10" })
                              <span class="error" id="contactError">*</span>
                            </div>
                            <br />
                            <br />
                        </li>
                        <li id="li_7">
                            <label class="description" for="element_3">
                                Contact 2
                            </label>
                            <br />
                            <div>
                                @Html.TextBoxFor(m => m.ContactNumber2, new { id = "txtContactNumber2", name = "element_3", @class = "element text medium", type = "text", maxlength = "255", value = "" })
                            </div>
                            <br />
                            <br />
                        </li>
                        <li id="li_8">
                            <label class="description" for="element_3">
                                Temprorary Address
                            </label>
                            <br />
                            <div>
                                @Html.TextBoxFor(m => m.TemporaryAddress, new { id = "txtTempAddress", name = "element_3", @class = "element text medium requiredField", type = "text", maxlength = "255", value = "" })
                               <span class="error" id="tempAddressError">*</span>
                            </div>
                            <br />
                            <br />
                        </li>
                        <li id="li_9">
                            <label class="description" for="element_3">
                                Permanent Address
                            </label>
                            <br />
                            <div>
                                @Html.TextBoxFor(m => m.PermanentAddress, new { id = "txtPermanentAddress", name = "element_3", @class = "element text medium requiredField", type = "text", maxlength = "255", value = "" })
                               <span class="error" id="paramAddressError">*</span>
                            </div>
                            <br />
                            <br />
                        </li>
                        <li id="li_10">
                            <label class="description" for="element_3">
                                PIN Code
                            </label>
                            <br />
                            <div>
                                @Html.TextBoxFor(m => m.Pincode, new { id = "txtPincode", name = "element_3", @class = "element text medium requiredField", type = "text", maxlength = "255", value = "" })
                                <span class="error" id="pinCodeError">*</span>
                            </div>
                            <br />
                            <br />
                        </li>
                        <li id="li_11">
                            <label class="description" for="element_3">
                                State
                            </label>
                            <br />
                            <div>
                                @Html.TextBoxFor(m => m.State, new { id = "txtState", name = "element_3", @class = "element text medium requiredField", type = "text", maxlength = "255", value = "" })
                               <span class="error" id="stateError">*</span>
                            </div>
                            <br />
                            <br />
                        </li>
                        <li id="li_12">
                            <label class="description" for="element_3">
                                City
                            </label>
                            <br />
                            <div>
                                @Html.TextBoxFor(m => m.City, new { id = "txtCity", name = "element_3", @class = "element text medium requiredField", type = "text", maxlength = "255", value = "" })
                             <span class="error" id="cityError">*</span>
                            </div>
                            <br />
                            <br />
                        </li>
                                        <li id="li_13">
                                        <br />
                                            
                                            <button class="btn btn-orange" runat="server">
                                    Register</button>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                <button class="btn btn-orange" id="btnCancel">
                                    Cancel</button>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="Login">Click here
                                        to Login !</a>
                                        
                                        </li>
                                        <br />
                                    </ul>
                    </div>
                    
                </div>
            </div>
        </div>
    </div>
}

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
